/*
 * Licensed under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.submarine.common;

import org.apache.log4j.Level;

/**
 * @file org.submarine.common.Logger.java
 *
 * 日志
 * 
 * @author gaojian
 * @created 2013-8-19 下午4:40:00
 * @version 0.0.1
 * @since 0.0.1
 * 
 */
public final class Logger {
	
	private static Logger localLogger = new Logger();
	
	private static org.apache.log4j.Logger logger;
	
	private static final String FQCN = Logger.class.getName();
	
	private Logger() {}
	
	public static Logger getLogger(Class<?> clazz) {
		logger = org.apache.log4j.Logger.getLogger(clazz.getName());
		return localLogger;
	}
	
	private org.apache.log4j.Logger getLogger() {
		return logger;
	}
	
	public void info(String message) {
		getLogger().log(FQCN, Level.INFO, message, null);
	}
	
	public void info(String message, Throwable t) {
		getLogger().log(FQCN, Level.INFO, message, t);
	}
	
	public void debug(String message, Throwable t) {
		getLogger().log(FQCN, Level.DEBUG, message, t);
	}
	
	public void warn(String message, Throwable t) {
		getLogger().log(FQCN, Level.WARN, message, t);
	}
	
	public void record(String message) {
		getLogger().log(FQCN, Level.RECORD, message, null);
	}
	
	public void record(String message, Throwable t) {
		getLogger().log(FQCN, Level.RECORD, message, t);
	}
	
	public void error(String message, Throwable t) {
		getLogger().log(FQCN, Level.ERROR, message, t);
	}

}
